#include "OpenGLCommon.h"

#ifndef _OPENGL_TEXTURE_H_
#define _OPENGL_TEXTURE_H_

namespace Hiranipra {
	namespace Platform {
		namespace Graphics {

			class Texture : implements ITexture
			{
			public:
				Texture( GLuint textureId, uint32 width, uint32 height, uint32 channels );
				virtual ~Texture();

				virtual uint32 GetWidth() const { return _width; }
				virtual uint32 GetHeight() const { return _height; }
				virtual PixelFormat GetPixelFormat() const { return _format; }

				GLuint GetTextureID() const { return _textureId; }
				void Activate( uint32 stage );

			public:
				virtual bool Upload();
				virtual bool GetData( void* buffer, uint32 startIndex, uint32 elementCount ) const;
				virtual void SetData( const void* buffer, uint32 startIndex, uint32 elementCount, bool discard );

			private:
				uint32		_width;
				uint32		_height;
				PixelFormat	_format;

				GLuint		_textureId;
			};

		}
	}
}

#endif // _OPENGL_TEXTURE_H_
